package net.malkuth.test;

import android.app.Activity;
import android.os.Bundle;
import android.view.View;
import android.widget.ImageButton;
import android.widget.ListView;
import android.widget.SimpleAdapter;
import android.widget.TextView;

import java.util.ArrayList;
import java.util.HashMap;
import java.util.List;
import java.util.Map;

/**
 * 综合能力界面
 * 
 * @author X_zH0u
 *
 */
public class AbilityActivity extends Activity {

	private ListView mAbility_Listview;
	private List<Map<String, Object>> mList;
	private String[] content = { "提要求", "命名", "听者反映", "视觉配对", "游戏", "游戏", "游戏" };
	private int[] total = { 120, 80, 100, 100, 100, 100, 10 };
	private String[] reach = { "70%", "80%", "60%", "60%", "65%", "96", "15%" };
	private TextView tv_title;
	private ImageButton iv_back;

	@Override
	protected void onCreate(Bundle savedInstanceState) {
		super.onCreate(savedInstanceState);
		setContentView(R.layout.activity_ability);

		tv_title = (TextView) findViewById(R.id.tv_title_bar);
		iv_back = (ImageButton) findViewById(R.id.iv_back);
		mAbility_Listview = (ListView) findViewById(R.id.ability_listview);
		initView();
	}

	/**
	 * 显示数据
	 */
	private void initView() {
		tv_title.setText("综合能力");
		mList = new ArrayList<Map<String, Object>>();
		for (int i = 0; i < content.length; i++) {
			Map<String, Object> map = new HashMap<String, Object>();
			map.put("content", content[i]);
			map.put("total", total[i]);
			map.put("reach", reach[i]);
			mList.add(map);
		}
		SimpleAdapter adapter = new SimpleAdapter(AbilityActivity.this, mList, R.layout.ability_item,
				new String[] { "content", "total", "reach" },
				new int[] { R.id.ability_textview1, R.id.ability_textview2, R.id.ability_textview3 });
		mAbility_Listview.setAdapter(adapter);
	}

	/**
	 * 单击事件
	 */
	public void click(View view) {
		switch (view.getId()) {
		// 头部单击返回
		case R.id.iv_back:
			this.finish();
			break;
		}
	}
}
